Load Packages and Data

Cleaning Data

#write_csv(GTBK_data, file = "/data/GTBK_data")

Visualizations

GTBK_data %>%
  group_by(especie_nombre_latino) %>%
count()  
## # A tibble: 5 × 2
## # Groups:   especie_nombre_latino [5]
##   especie_nombre_latino      n
##   <chr>                  <int>
## 1 Caretta caretta            2
## 2 Chelonia mydas           848
## 3 Eretmochelys imbricata     7
## 4 Lepidochelys olivacea     15
## 5 <NA>                       8

Visualizations

buis_2022 %>% 
  mutate(species = case_when(
    sp == "HB" ~ "Eretmochelys imbricata",
    sp == "GR" ~ "Chelonia mydas")
  ) %>% 
  ggplot(aes(x = species, y = cclnuct, fill = species)) +
  geom_violin() +
  scale_fill_manual(values = c("chartreuse4", "hotpink4")) + 
  theme_minimal() +
  coord_flip () +
  labs(title = "Average Curved Carapace Length of Green and Hawksbill Sea Turtles",
       subtitle = "Reproductive Females Measured During 2022 Nesting Season on Buck Island, USVI",
       x = "Species", 
       y = "Curved Carapace Length (cm)",
       fill = "Species")
## Warning: Removed 10 rows containing non-finite values (`stat_ydensity()`).

buis_2022 %>% 
  mutate(species = case_when(
    sp == "HB" ~ "Eretmochelys imbricata",
    sp == "GR" ~ "Chelonia mydas")
  ) %>% 
  ggplot(aes(x = species, y = cclnuct, fill = species)) +
  geom_boxplot() +
  scale_fill_manual(values = c("chartreuse4", "hotpink4")) + 
  theme_minimal() +
  coord_flip () +
  labs(title = "Average Curved Carapace Length of Green and Hawksbill Sea Turtles",
       subtitle = "Reproductive Females Measured During 2022 Nesting Season on Buck Island, USVI",
       x = "Species", 
       y = "Curved Carapace Length (cm)",
       fill = "Species")
## Warning: Removed 10 rows containing non-finite values (`stat_boxplot()`).

GTBK_data %>%
  filter(especie_nombre_latino == "Chelonia mydas" |
         especie_nombre_latino == "Eretmochelys imbricata" |
         especie_nombre_latino == "Lepidochelys olivacea" |
         especie_nombre_latino == "Caretta caretta") %>%
  ggplot(aes(x = especie_nombre_latino, y = a_c_c, fill = especie_nombre_latino)) +
  geom_boxplot() +
  scale_fill_manual(values = c("goldenrod1","chartreuse4", "hotpink4","cornflowerblue")) +
  theme_minimal() +
  coord_flip() +
  facet_wrap(~ geografía) +
  labs(title = "Curved Carapace Length Measurements of Four Sea Turtle Species",
       subtitle = "Monitored by GTBK in Kino Bay, Mexico between 2010-2023",
       x = "Species",
       y = "Curved Carapace Length (cm)",
       fill = "Species")
## Warning: Removed 1 rows containing non-finite values (`stat_boxplot()`).

GTBK_data %>% 
  filter(numero_recaptura %in% c(2, 3, 4)) %>% 
  ggplot(aes(x = numero_recaptura)) +
  geom_bar()

GTBK_data %>% 
  filter(numero_recaptura %in% c(2, 3, 4)) %>% 
  ggplot(aes(x = numero_recaptura, fill = sexo_correcto)) +
  geom_bar()

GTBK_data %>% 
  filter(numero_recaptura %in% c(1, 2, 3, 4)) %>% 
  filter(especie_nombre_latino == "Chelonia mydas" | 
         especie_nombre_latino == "Eretmochelys imbricata" |
         especie_nombre_latino == "Caretta caretta" |
         especie_nombre_latino == "Lepidochelys olivacea") %>% 
  ggplot(aes(x = numero_recaptura, fill = especie_nombre_latino)) +
  geom_bar() +
  scale_fill_manual(values = c("firebrick2", "darkseagreen", "royalblue4", "yellow2")) +
  theme_minimal() +
  labs(title = "Number of Sea Turtle Recaptures by GTBK",
       subtitle = "Of Four Sea Turtle Species in Kino Bay, Mexico",
       x = "Number of Times Recaptured",
       y = "Number of Turtles",
       fill = "Species")

# recapture_tibble <- GTBK_data %>%
#   group_by(marca_nombre) %>%
#   select(nombre_tortuga, fecha, especie, area_de_monitoreo, marca_nombre)
# 
# 
# recapture_tibble %>%
#   group_by(marca_nombre) %>%
#   summarize(marca_nombre)
GTBK_data %>%
  group_by(especie_nombre_latino) %>%
  count (sexo_correcto)
## # A tibble: 9 × 3
## # Groups:   especie_nombre_latino [5]
##   especie_nombre_latino  sexo_correcto     n
##   <chr>                  <chr>         <int>
## 1 Caretta caretta        Indefinido        2
## 2 Chelonia mydas         Hembra          339
## 3 Chelonia mydas         Indefinido      483
## 4 Chelonia mydas         Macho            26
## 5 Eretmochelys imbricata Indefinido        7
## 6 Lepidochelys olivacea  Hembra           10
## 7 Lepidochelys olivacea  Indefinido        1
## 8 Lepidochelys olivacea  Macho             4
## 9 <NA>                   <NA>              8
# GTBK_2018_2023 %>% 
#   group_by(especie_nombre_latino) %>% 
#   count(Sexo)

# GTBK_2010_2018 %>% 
#   group_by(Especie) %>% 
#   count(Sexo) 

buis_2022 %>% 
  group_by(sp) %>% 
  count(sex)
## # A tibble: 2 × 3
## # Groups:   sp [2]
##   sp    sex        n
##   <chr> <chr>  <int>
## 1 GR    female    27
## 2 HB    female    29
GTBK_data %>%
  filter(numero_recaptura == 1) %>%
  group_by(especie_nombre_latino) %>%
  count (sexo_correcto)
## # A tibble: 9 × 3
## # Groups:   especie_nombre_latino [5]
##   especie_nombre_latino  sexo_correcto     n
##   <chr>                  <chr>         <int>
## 1 Caretta caretta        Indefinido        2
## 2 Chelonia mydas         Hembra          248
## 3 Chelonia mydas         Indefinido      380
## 4 Chelonia mydas         Macho            23
## 5 Eretmochelys imbricata Indefinido        7
## 6 Lepidochelys olivacea  Hembra           10
## 7 Lepidochelys olivacea  Indefinido        1
## 8 Lepidochelys olivacea  Macho             4
## 9 <NA>                   <NA>              1
GTBK_data %>%
filter(especie_nombre_latino != "NA") %>%
  filter(numero_recaptura == 1) %>%
ggplot(aes(x = sexo_correcto, 
                     fill = sexo_correcto)) +
  geom_bar() + 
  facet_wrap( ~ especie_nombre_latino, 
              # <- fct_relevel(especie_nombre_latino, 
              #                         "Caretta caretta",
              #                          "Eretmochelys imbricata", 
              #                          "Lepidochelys olivacea",
              #                          "Chelonia mydas"),
               scales = "free_y") +
   labs(title = "Species and Sex Distribution", 
       subtitle = "of turtles captured in Kino Bay", 
       x = "sex", 
       y = "number of individuals", 
       fill = "sex") +
 scale_fill_manual(values = c("#cd4071","#feca8d", "#721f81", "#000004"))

naniar::gg_miss_var(GTBK_data)

visdat::vis_miss(GTBK_data)
## Warning: Raster pixels are placed at uneven horizontal intervals and will be shifted
## ℹ Consider using `geom_tile()` instead.

visdat::vis_miss(GTBK_2018_2023)

GTBK Recapture Visualizations

# they went out 880 times total. 
# There are 188 instances of recaptures 
GTBK_data <- GTBK_data %>% 
  mutate(mes = month(fecha)) %>%
  mutate(año = year(fecha))

GTBK_outings <- GTBK_data %>%
      group_by(mes) %>%
      count(mes)

GTBK_recapturas <- GTBK_data %>%
  filter(numero_recaptura %in% c(2, 3, 4)) %>%
  group_by(mes) %>%
  count(mes)

full_join(GTBK_outings, GTBK_recapturas, by = "mes") %>%
   mutate(tortugas_por_esfuerzo = n.y/n.x) %>%
   select(mes, tortugas_por_esfuerzo) %>%
   ggplot(aes(x = mes, y = tortugas_por_esfuerzo)) +
   geom_col() 
## Warning: Removed 1 rows containing missing values (`position_stack()`).

# This code chunk is not to be messed with under any circumstance!
#GTBK_data <- 
GTBK_data %>%
  mutate(yearmonth = ym(paste(año, mes, sep = "-")))
## Warning: There were 3 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `yearmonth = ym(paste(año, mes, sep = "-"))`.
## ℹ In group 1: `marca_nombre = ""`.
## Caused by warning:
## !  1 failed to parse.
## ℹ Run ]8;;ide:run:dplyr::last_dplyr_warnings()dplyr::last_dplyr_warnings()]8;; to see the 2 remaining warnings.
## # A tibble: 880 × 39
## # Groups:   marca_nombre [767]
##    nombre_to…¹ estac…² fecha               area_…³ posic…⁴ hora_…⁵ especie  peso
##    <chr>       <chr>   <dttm>              <chr>   <chr>   <chr>   <chr>   <dbl>
##  1 Lencho      <NA>    2010-10-11 00:00:00 ISPM    N28º37… 0.1458… Chelon…  15  
##  2 Lili        <NA>    2010-10-12 00:00:00 ISPM    N28º37… <NA>    Chelon…  18  
##  3 Alejandra … <NA>    2010-10-12 00:00:00 ISPM    <NA>    <NA>    Chelon…  17.5
##  4 Ana  Luisa  <NA>    2010-10-12 00:00:00 ISPM    N28º22… <NA>    Chelon…  27  
##  5 Naomi       Primav… 2011-03-15 00:00:00 ISPM    N28371… <NA>    Chelon…  19  
##  6 Romelia     Primav… 2011-03-16 00:00:00 ISPM    N28371… <NA>    Chelon…  17.6
##  7 LORAYNE     Primav… 2011-03-16 00:00:00 ISPM    n28221… <NA>    Chelon…  21.6
##  8 profepa     Verano  2012-10-08 00:00:00 choyud… <NA>    <NA>    Eretmo…   4  
##  9 prescolina  Otono   2012-05-11 00:00:00 Alcalt… N23.83… 0.5124… Chelon…  32  
## 10 PAPIRINGO   Invier… 2013-10-01 00:00:00 Pta. B… N28.78… 0.5277… Chelon…  42.8
## # … with 870 more rows, 31 more variables: sexo <chr>, l_r_c <dbl>,
## #   l_c_c <dbl>, a_r_c <dbl>, a_c_c <dbl>, p_c <dbl>, l_p <dbl>, l_t_c <dbl>,
## #   marca_nombre <chr>, marca_izquierda <chr>, fecha_inicio <dttm>,
## #   hora_inicio <dbl>, hora_fin <dbl>, total_horas <dbl>, tipo_monitoreo <chr>,
## #   metodologia <chr>, latitud <dbl>, longitud <dbl>,
## #   unidad_utm_o_grados <chr>, hora_captura <dbl>, material_marcas <chr>,
## #   marca_previa_izquierda <chr>, comentarios <chr>, …
tortugas_por_tiempo <- GTBK_data %>%   #counting every time they caught a turtle
  filter(numero_recaptura %in% c(1, 2, 3, 4)) %>%
  group_by(fecha, mes, año) %>%
  drop_na(marca_nombre) %>%
  summarize(turtles = n()) %>%
  group_by(mes, año) %>%
  summarize(total_turtles = sum(turtles, na.rm = T))
## `summarise()` has grouped output by 'fecha', 'mes'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
tiempo <- GTBK_data %>%    # of times they went out
  distinct(fecha, mes, año) %>%
  group_by(mes, año) %>%
  summarize(effort = n())
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
# full_join(GTBK_outings, GTBK_recapturas, by = "mes") %>%
#    mutate(tortugas_por_esfuerzo = n.y/n.x) %>%
#    select(mes, tortugas_por_esfuerzo) %>%
#    ggplot(aes(x = mes, y = tortugas_por_esfuerzo)) +
#    geom_col() 
GTBK_data %>%
  mutate(yearmonth = ym(paste(año, mes, sep = "-")))
## Warning: There were 3 warnings in `mutate()`.
## The first warning was:
## ℹ In argument: `yearmonth = ym(paste(año, mes, sep = "-"))`.
## ℹ In group 1: `marca_nombre = ""`.
## Caused by warning:
## !  1 failed to parse.
## ℹ Run ]8;;ide:run:dplyr::last_dplyr_warnings()dplyr::last_dplyr_warnings()]8;; to see the 2 remaining warnings.
## # A tibble: 880 × 39
## # Groups:   marca_nombre [767]
##    nombre_to…¹ estac…² fecha               area_…³ posic…⁴ hora_…⁵ especie  peso
##    <chr>       <chr>   <dttm>              <chr>   <chr>   <chr>   <chr>   <dbl>
##  1 Lencho      <NA>    2010-10-11 00:00:00 ISPM    N28º37… 0.1458… Chelon…  15  
##  2 Lili        <NA>    2010-10-12 00:00:00 ISPM    N28º37… <NA>    Chelon…  18  
##  3 Alejandra … <NA>    2010-10-12 00:00:00 ISPM    <NA>    <NA>    Chelon…  17.5
##  4 Ana  Luisa  <NA>    2010-10-12 00:00:00 ISPM    N28º22… <NA>    Chelon…  27  
##  5 Naomi       Primav… 2011-03-15 00:00:00 ISPM    N28371… <NA>    Chelon…  19  
##  6 Romelia     Primav… 2011-03-16 00:00:00 ISPM    N28371… <NA>    Chelon…  17.6
##  7 LORAYNE     Primav… 2011-03-16 00:00:00 ISPM    n28221… <NA>    Chelon…  21.6
##  8 profepa     Verano  2012-10-08 00:00:00 choyud… <NA>    <NA>    Eretmo…   4  
##  9 prescolina  Otono   2012-05-11 00:00:00 Alcalt… N23.83… 0.5124… Chelon…  32  
## 10 PAPIRINGO   Invier… 2013-10-01 00:00:00 Pta. B… N28.78… 0.5277… Chelon…  42.8
## # … with 870 more rows, 31 more variables: sexo <chr>, l_r_c <dbl>,
## #   l_c_c <dbl>, a_r_c <dbl>, a_c_c <dbl>, p_c <dbl>, l_p <dbl>, l_t_c <dbl>,
## #   marca_nombre <chr>, marca_izquierda <chr>, fecha_inicio <dttm>,
## #   hora_inicio <dbl>, hora_fin <dbl>, total_horas <dbl>, tipo_monitoreo <chr>,
## #   metodologia <chr>, latitud <dbl>, longitud <dbl>,
## #   unidad_utm_o_grados <chr>, hora_captura <dbl>, material_marcas <chr>,
## #   marca_previa_izquierda <chr>, comentarios <chr>, …
tortugas_por_tiempo <- GTBK_data %>%   #counting every time they caught a turtle
  filter(numero_recaptura %in% c(1, 2, 3, 4)) %>%
  group_by(fecha, mes, año) %>%
  drop_na(marca_nombre) %>%
  summarize(turtles = n()) %>%
  group_by(mes, año) %>%
  summarize(total_turtles = sum(turtles, na.rm = T))
## `summarise()` has grouped output by 'fecha', 'mes'. You can override using the
## `.groups` argument.
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
tiempo <- GTBK_data %>%    # of times they went out
  distinct(fecha, mes, año) %>%
  group_by(mes, año) %>%
  summarize(effort = n())
## `summarise()` has grouped output by 'mes'. You can override using the `.groups`
## argument.
full_join(tortugas_por_tiempo, tiempo) %>%
   mutate(esfuerzo = total_turtles/effort)
## Joining with `by = join_by(mes, año)`
## # A tibble: 97 × 5
## # Groups:   mes [13]
##      mes   año total_turtles effort esfuerzo
##    <dbl> <dbl>         <int>  <int>    <dbl>
##  1     1  2015             5      5        1
##  2     1  2016             3      3        1
##  3     1  2017             8      8        1
##  4     2  2015             3      3        1
##  5     2  2016             1      1        1
##  6     2  2017             4      4        1
##  7     2  2018             1      1        1
##  8     2  2020             2      2        1
##  9     2  2021             3      3        1
## 10     2  2023             1      1        1
## # … with 87 more rows
   # select(mes, tortugas_por_esfuerzo) %>%
   # ggplot(aes(x = mes, y = tortugas_por_esfuerzo)) +
   # geom_col()

Turtle Photos/Memes

A Green sea turtle hatchling headed toward the sea.

A Green sea turtle hatchling headed toward the sea.

A Hawksbill sea turtle laying her nest on Buck Island.

A Hawksbill sea turtle laying her nest on Buck Island.